
const path = require('path')
const webpack = require('webpack')
const htmlWpackPlugin = require('html-webpack-plugin')
// const cleanWebpackPlugin = require('clean-webpack-plugin')

module.exports={
    entry: path.join(__dirname,'./src/main.js'),
    output:{
        path: path.join(__dirname,'./dist'),
        filename:'bundle.js'
    },
    plugins:[
        new webpack.HotModuleReplacementPlugin(),
        new htmlWpackPlugin({
            template:path.join(__dirname,'./src/index.html'),
            filename:'index.html'
        })
        // new cleanWebpackPlugin(['dist'])
    ],
    module:{
        rules:[
            {test: /\.css$/,use:['style-loader','css-loader']} ,
            {test: /\.(png|gif|jpg)$/,use:'url-loader?limit=5000&name=images/[hash:8]-[name].[exit]'} ,
            {test: /\.js$/,use:'babel-loader',exclude: /node_modules/} ,
        ]
    },
    mode:'development'
}